<!--Copyright (C) Kherty.  All rights reserved.-->
<Window x:Class="OpenLS.Spreadsheet.UI.PrintPreviewWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:oui="clr-namespace:OpenLS.UI;assembly=OpenLS.UI"
    xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI"
        xmlns:media="clr-namespace:OpenLS.Media;assembly=OpenLS.Media"
        xmlns:Internals="clr-namespace:OpenLS.Spreadsheet.UI.Internals"
        xmlns:Resources="clr-namespace:OpenLS.Spreadsheet.UI.Internals.Resources"
        Title="{Binding Source={x:Static ApplicationCommands.PrintPreview}, Path=Text}">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ssui:WorksheetPageResources />
                <oui:OfficeResources/>
                <ssui:PageMarginsResources></ssui:PageMarginsResources>

            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <oui:RibbonElement.IconProvider>
        <media:IconProvider />
    </oui:RibbonElement.IconProvider>

    <Grid>
        <Grid.CommandBindings>
            <CommandBinding Command="{x:Static ssui:SpreadsheetCommands.PageSetup}" Executed="OnPageSetup"/>
            <CommandBinding Command="{x:Static oui:ViewCommands.SetPageMargin}" Executed="onSetPageMargins"></CommandBinding>
        </Grid.CommandBindings>
        <DockPanel>
            <oui:Ribbon DockPanel.Dock="Top">
                <oui:Group Header="{Binding Source={x:Static ApplicationCommands.Print}, Path=Text}">
                    <StackPanel Orientation="Horizontal">
                        <Menu>
                            <MenuItem Command="{x:Static ssui:SpreadsheetCommands.PageSetup}"/>
                            <MenuItem Header="{x:Static Resources:UIStringTable.Margins}" oui:RibbonElement.Icon="{media:Image MarginGallery}"
                      ItemsSource="{x:Static Internals:PaperHelper.PageMargins}">

                                <MenuItem.ItemContainerStyle>
                                    <Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource {x:Type MenuItem}}">
                                        <Setter Property="Command" Value="{x:Static oui:ViewCommands.SetPageMargin}"/>
                                        <Setter Property="CommandParameter" Value="{Binding}"/>
                                    </Style>
                                </MenuItem.ItemContainerStyle>
                            </MenuItem>

                        </Menu>
                    </StackPanel>
                </oui:Group>
            </oui:Ribbon>
            <DockPanel>
                <ListBox ItemsSource="{Binding}" SelectedIndex="0" DockPanel.Dock="Bottom" Name="lb">
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel Orientation="Horizontal"></VirtualizingStackPanel>
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Number}"></TextBlock>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
                <ScrollViewer>
                    <Border BorderBrush="Black" BorderThickness="1 1 2 2" HorizontalAlignment="Center">
                        <ContentControl Content="{Binding ElementName=lb, Path=SelectedItem}"></ContentControl>
                    </Border>
                </ScrollViewer>
            </DockPanel>
        </DockPanel>

    </Grid>
</Window>
